home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 24
/
AMIGAplus Sonderheft 24 (2000)(Falke)(DE)[!].iso
/
PublicDomain
/
Anwendungen
/
MT-RechnungIII
/
Rexx
/
WWAngebot.outrexx
< prev
next >
Wrap
Text File
|
1998-11-16
|
11KB
|
492 lines
/*
** Druck-, Vorschau, Sichern des Angebots mit Hilfe von WordWorth
** $VER: WWAngebot.outrexx V1.03 (17.11.98)
*/
PARSE ARG ARexxPort;
ADDRESS VALUE ARexxPort;
OPTIONS RESULTS;
WWVorlage = "WWDokumente/Angebot.ww";
WWDokument = "t:Angebot.ww";
WWPort = "WORDWORTH."
LF = '0a'x; /* Zeilenvorschub */
Gefunden = 0;
DO i = 1 TO 20 WHILE(Gefunden = 0)
IF show(ports, (WWPort || i)) THEN
DO;
Gefunden = 1;
WWPort = WWPort || i;
END;
END;
IF Gefunden = 0 THEN
DO;
ES_TITLE = "Warnung";
ES_TEXTFORMAT = "WordWorth ist nicht aktiv, bitte starten sie dieses" || LF || "und versuchen Sie es erneut";
ES_GADGETFORMAT = "Abbrechen";
EASY_REQUEST;
EXIT;
END;
/* Original WW-Dokument nach t: kopieren, um ein versehentliches überschreiben */
/* dieser Vorlage zu verhindern */
GET_REXXPATH;
WWVorlage = MTR_RESULT || WWVorlage;
ADDRESS COMMAND "copy" WWVorlage WWDokument;
/* Oberfläche sperren */
LOCKGUI;
/* Art ermitteln: 0 = Drucken, 1 = Vorschau, 2 = Speichern */
PRINTSTATE;
Druckart = MTR_RESULT;
Ende_Kennzeichen = 'N';
/* Suchen der zu druckenden Daten */
GET_PREFS;
PRINTFIND;
/* Neues Dokument öffnen */
ADDRESS VALUE WWPort;
NEW;
WWPort = RESULT;
DO WHILE( MTR_RESULT > 0 & Ende_Kennzeichen = 'N');
CALL DatenAufbereiten;
SELECT;
WHEN Druckart = 0 THEN /* Drucken */
DO;
ADDRESS VALUE WWPort;
PRINT;
ADDRESS VALUE ARexxPort;
MTSCREENTOFRONT;
END;
WHEN Druckart = 1 THEN /* Vorschau */
ADDRESS VALUE ARexxPort;
WHEN Druckart = 2 THEN /* Sichern */
DO;
ADDRESS VALUE WWPort;
SAVEAS;
ADDRESS VALUE ARexxPort;
MTSCREENTOFRONT;
END;
OTHERWISE
DO;
ES_TITLE = "Warnung";
ES_TEXTFORMAT = "Druckart wird nicht unterstützt!";
ES_GADGETFORMAT = "Ok";
EASY_REQUEST;
Ende_Kennzeichen = 'J';
END;
END;
PRINTFIND;
END;
/* WordWorth-Datei aus t: wieder entfernen */
ADDRESS COMMAND "delete" WWDokument;
/* Oberfläche wieder entsperren */
ADDRESS VALUE ARexxPort;
FREEGUI;
EXIT;
DatenAufbereiten:
ADDRESS VALUE ARexxPort;
IF PREFS.NUMBER_DIGITS > 0 THEN
DO;
ZW_Rechnung = RIGHT( (Copies("0",PREFS.NUMBER_DIGITS) || MTR_RESULT), PREFS.NUMBER_DIGITS );
ZW_Kunde = RIGHT( (Copies("0",PREFS.NUMBER_DIGITS) || OB.INVOICEE_NUMBER), PREFS.NUMBER_DIGITS );
END;
ELSE
DO;
ZW_Rechnung = MTR_RESULT;
ZW_Kunde = OB.INVOICEE_NUMBER;
END;
IF PREFS.CLIENT_CODE = 1 THEN
ZW_Kunde = OB.INVOICEE.CUSTOMER.CLIENT_CODE;
FORMAT_DATE_LONG date(s);
PRINTDATE = MTR_RESULT;
FORMAT_DATE_LONG OB.DATE_TENDER;
TENDER_DATE_LONG = MTR_RESULT;
w = OB.CURRENCY_USED;
IF w < 2 THEN
FORMAT_MONEY1 OB.TOTAL_M_ALL_CH.w;
ELSE
FORMAT_MONEY2 OB.TOTAL_M_ALL_CH.w;
ZW_Betrag = MTR_RESULT;
IF w < 2 THEN
FORMAT_MONEY1 OB.DISPATCH_COSTS.w;
ELSE
FORMAT_MONEY2 OB.DISPATCH_COSTS.w;
ZW_Versand = MTR_RESULT;
FORMAT_NUMBER OB.DISCOUNT_PERCENT PREFS.FRAC_DIGITS_PERCENT;
DISP = MTR_RESULT;
IF w < 2 THEN
FORMAT_MONEY1 OB.DISCOUNT.w;
ELSE
FORMAT_MONEY2 OB.DISCOUNT.w;
DIS = MTR_RESULT;
IF w < 2 THEN
FORMAT_MONEY1 OB.TOTAL_M_ALL_CH.0;
ELSE
FORMAT_MONEY2 OB.TOTAL_M_ALL_CH.2;
SUM_NET = MTR_RESULT;
IF w < 2 THEN
FORMAT_MONEY1 OB.TOTAL_M_ALL_CH.1;
ELSE
FORMAT_MONEY2 OB.TOTAL_M_ALL_CH.3;
SUM_GROSS = MTR_RESULT;
ADDRESS VALUE WWPort;
OPEN FILENAME WWDokument FORCE;
DruckString = OB.OFFICE.ADDRESS.ADDRESS.2 || LF;
i = INDEX( DruckString, LF);
IF i > 0 THEN
DO;
DruckTeil = LEFT( DruckString, (i - 1) );
DruckString = SUBSTR(DruckString, (i + 1) );
i = INDEX( DruckString, LF);
END;
ELSE
DruckTeil = DruckString;
FINDCHANGE FIND "<OFFICE.ADDRESS.ADDRESS.2>" CHANGE DruckTeil;
DO WHILE( i > 0 );
DruckTeil = LEFT( DruckString, (i - 1) );
DruckString = SUBSTR(DruckString, (i + 1) );
LINE 1;
TEXT DruckTeil;
i = INDEX( DruckString, LF);
END;
POSITION SOV;
FINDCHANGE FIND "<PRINTDATE>" CHANGE PRINTDATE;
/* Leider wird bei längeren Texten der hintere Teil verschluckt, also nochmal ausgeben */
TEXT PRINTDATE;
FINDCHANGE FIND "<OFFICE.ADDRESS.ADDRESS.0>" CHANGE OB.OFFICE.ADDRESS.ADDRESS.0;
/* Leider wird bei längeren Texten der hintere Teil verschluckt, also nochmal ausgeben */
TEXT OB.OFFICE.ADDRESS.ADDRESS.0;
IF OB.INVOICEE_NUMBER = 0 THEN
FINDCHANGE FIND "<CUSTOMER.ADDRESS.ADDRESS.2>" CHANGE "Barverkauf";
ELSE
DO;
DruckString = OB.INVOICEE.CUSTOMER.ADDRESS.ADDRESS.2 || LF;
i = INDEX( DruckString, LF);
IF i > 0 THEN
DO;
DruckTeil = LEFT( DruckString, (i - 1) );
DruckString = SUBSTR(DruckString, (i + 1) );
i = INDEX( DruckString, LF);
END;
ELSE
DruckTeil = DruckString;
FINDCHANGE FIND "<CUSTOMER.ADDRESS.ADDRESS.2>" CHANGE DruckTeil;
DO WHILE( i > 0 );
DruckTeil = LEFT( DruckString, (i - 1) );
DruckString = SUBSTR(DruckString, (i + 1) );
LINE 1;
TEXT DruckTeil;
i = INDEX( DruckString, LF);
END;
END;
POSITION SOV;
FIND "<OB.CONSIGNEE.ADDRESS.ADDRESS.2>"
if OB.CONSIGNEE_NUMBER = 0 THEN
DO;
POSITION SOL;
SHIFTDOWN;
LINE 1;
SHIFTUP;
BACKSPACE;
END;
ELSE
DO;
j = 0;
DruckString = OB.CONSIGNEE.CUSTOMER.ADDRESS.ADDRESS.2 || LF;
i = INDEX( DruckString, LF);
DO WHILE( i > 0 );
DruckTeil = LEFT( DruckString, (i - 1) );
DruckString = SUBSTR(DruckString, (i + 1) );
IF j > 0 THEN
DO;
NEWPARAGRAPH;
TEXT " ";
END
TEXT DruckTeil;
i = INDEX( DruckString, LF);
j = j + 1;
END;
END;
FINDCHANGE FIND "<OB.INVOICEE_NUMBER>" CHANGE ZW_Kunde;
FINDCHANGE FIND "<OB.NUMBER>" CHANGE ZW_Rechnung;
FINDCHANGE FIND "<OB.DATE_TENDER>" CHANGE TENDER_DATE_LONG;
/* Leider wird bei längeren Texten der hintere Teil verschluckt, also nochmal ausgeben */
TEXT TENDER_DATE_LONG;
FINDCHANGE FIND "<OB.EMPLOYEE.SUR_PRENAME>" CHANGE (OB.EMPLOYEE.ADDRESS.PRENAME OB.EMPLOYEE.ADDRESS.SURNAME);
FIND "<ARTICLE>";
BACKSPACE;
DO i = 1 to OB.COUNT_ARTICLE;
ADDRESS VALUE ARexxPort;
ZW_ArtikelNr = OB.i.POS_ARTICLE_NUMBER_FORMATED;
FORMAT_NUMBER (OB.i.POS_QUANTITY / OB.i.POS_PRICE_UNIT) PREFS.FRAC_DIGITS;
ZW_Anzahl = MTR_RESULT;
NAME_OF_QUANTITY_UNIT OB.i.ARTICLE.QUANTITY_UNIT;
ZW_Einheit = MTR_RESULT;
j = OB.i.POS_VALUE;
FORMAT_NUMBER OB.VALUE_PERCENT.j PREFS.FRAC_DIGITS_PERCENT;
ZW_MWSt = MTR_RESULT;
ZW_Bezeichnung = OB.i.ARTICLE.DESCRIPTION;
IF w < 2 THEN
FORMAT_MONEY1 OB.i.POS_SINGLE_PRICE.w;
ELSE
FORMAT_MONEY2 OB.i.POS_SINGLE_PRICE.w;
ZW_EinzelPreis = MTR_RESULT;
ADDRESS VALUE WWPort;
TEXT ZW_ArtikelNr || " " || ZW_Anzahl || " " || ZW_Bezeichnung || " " || ZW_Einheit || " " || ZW_MWSt || " " || ZW_EinzelPreis;
IF OB.i.ARTICLE.ADDITIONAL_TEXT > "" THEN
DO;
DruckString = OB.i.ARTICLE.ADDITIONAL_TEXT || LF;
i2 = INDEX( DruckString, LF);
DO WHILE( i2 > 0 );
DruckTeil = LEFT( DruckString, (i2 - 1) );
DruckString = SUBSTR(DruckString, (i2 + 1) );
NEWPARAGRAPH;
TEXT " " || DruckTeil || " ";
i2 = INDEX( DruckString, LF);
END;
END;
IF OB.i.POS_REMARK > "" THEN
DO;
DruckString = OB.i.POS_REMARK || LF;
i2 = INDEX( DruckString, LF);
DO WHILE( i2 > 0 );
DruckTeil = LEFT( DruckString, (i2 - 1) );
DruckString = SUBSTR(DruckString, (i2 + 1) );
NEWPARAGRAPH;
TEXT " " || DruckTeil || " ";
i2 = INDEX( DruckString, LF);
END;
END;
DO i2 = 0 TO 2;
IF OB.i.POS_ADD_RED_USED.i2 > 0 THEN
DO;
ADDRESS VALUE ARexxPort;
j2 = OB.i.POS_ADD_RED_USED.i2 - 1;
IF OB.i.POS_ADD_RED_TYPE.i2 = 0 | OB.i.POS_ADD_RED_TYPE.i2 = 5 THEN
DO;
FORMAT_NUMBER OB.i.POS_ADD_RED_VALUE.i2.w PREFS.FRAC_DIGITS_PERCENT;
END;
ELSE
DO;
IF w < 2 THEN
FORMAT_MONEY1 OB.i.POS_ADD_RED_VALUE.i2.w;
ELSE
FORMAT_MONEY2 OB.i.POS_ADD_RED_VALUE.i2.w;
END;
ZW_EinzelZuAb = RIGHT(MTR_RESULT, 15);
IF w < 2 THEN
FORMAT_MONEY1 OB.i.POS_ADD_RED_VALUE_POS.i2.w;
ELSE
FORMAT_MONEY2 OB.i.POS_ADD_RED_VALUE_POS.i2.w;
ZW_PosZuAb = RIGHT(MTR_RESULT, 15);
ADDRESS VALUE WWPort;
NEWPARAGRAPH;
TEXT " " || PREFS.ADD_RED_TEXT.j2 || " " || ZW_EinzelZuAb || " " || ZW_PosZuAb;
E